// JavaScript code for generating the main page.

//Call var prefs = new _IG_Prefs(__MODULE_ID__); to get the
//User preferences (i.e. language) and pass this as an argument.



function setupMain(prefs){
  var main = document.getElementById('categories__mc__');	
  main.innerHTML = "";//wipe it clean

// JavaScript code for generating the main page.

  table = document.createElement("table");
  table.className = "categories";
  tr1 = table.insertRow(0);

  el = tr1.insertCell(0);
  var category = "adventure";
  var img_link = "http://boredombuster.googlecode.com/svn/trunk/images/128/"+category+".png";
  var tooltip = prefs.getMsg(category);
  html = '<a href="javascript:searchBusters(\''+category+'\', \''+img_link+'\');" onmouseover="popupCategoryName(\''+escape(tooltip)+'\');"><img src="'+img_link+'" title="'+tooltip+'" class="category" id="'+category+'"/></a>';
  el.innerHTML = html;

  el = tr1.insertCell(1);
  category = "cinema";
  img_link = img_link = "http://boredombuster.googlecode.com/svn/trunk/images/128/"+category+".png";
  tooltip = prefs.getMsg(category);
  html = '<a href="javascript:searchBusters(\''+category+'\', \''+img_link+'\');" onmouseover="popupCategoryName(\''+escape(tooltip)+'\');"><img src="'+img_link+'" title="'+tooltip+'" class="category" id="'+category+'"/></a>';
  el.innerHTML = html;


  el = tr1.insertCell(2);
  category = "culture";
  img_link = img_link = "http://boredombuster.googlecode.com/svn/trunk/images/128/"+category+".png";
  tooltip = prefs.getMsg(category);
  html = '<a href="javascript:searchBusters(\''+category+'\', \''+img_link+'\');" onmouseover="popupCategoryName(\''+escape(tooltip)+'\');"><img src="'+img_link+'" title="'+tooltip+'" class="category" id="'+category+'"/></a>';
  el.innerHTML = html;

  ////////////////////////////////////////////////
  //ROW 2
  ///////////////////////////////////////////////
  tr2 = table.insertRow(1);
  el = tr2.insertCell(0);
  category = "hotel";
  img_link = img_link = "http://boredombuster.googlecode.com/svn/trunk/images/128/"+category+".png";
  tooltip = prefs.getMsg(category);
  html = '<a href="javascript:searchBusters(\''+category+'\', \''+img_link+'\');" onmouseover="popupCategoryName(\''+escape(tooltip)+'\');"><img src="'+img_link+'" title="'+tooltip+'" class="category" id="'+category+'"/></a>';
  el.innerHTML = html;


  el = tr2.insertCell(1);
  category = "nature";
  img_link = img_link = "http://boredombuster.googlecode.com/svn/trunk/images/128/"+category+".png";
  tooltip = prefs.getMsg(category);
  html = '<a href="javascript:searchBusters(\''+category+'\', \''+img_link+'\');" onmouseover="popupCategoryName(\''+escape(tooltip)+'\');"><img src="'+img_link+'" title="'+tooltip+'" class="category" id="'+category+'"/></a>';
  el.innerHTML = html;


  el = tr2.insertCell(2);
  category = "nightlife";
  img_link = img_link = "http://boredombuster.googlecode.com/svn/trunk/images/128/"+category+".png";
  tooltip = prefs.getMsg(category);
  html = '<a href="javascript:searchBusters(\''+category+'\', \''+img_link+'\');" onmouseover="popupCategoryName(\''+escape(tooltip)+'\');"><img src="'+img_link+'" title="'+tooltip+'" class="category" id="'+category+'"/></a>';
  el.innerHTML = html;


  ///////////////////////////////////
  //ROW 3
  //////////////////////////////////
  tr3 = table.insertRow(2);
  el = tr3.insertCell(0);
  category = "restaurant";
  tooltip = prefs.getMsg(category);
  img_link = img_link = "http://boredombuster.googlecode.com/svn/trunk/images/128/"+category+".png";
  html = '<a href="javascript:searchBusters(\''+category+'\', \''+img_link+'\');" onmouseover="popupCategoryName(\''+escape(tooltip)+'\');"><img src="'+img_link+'" title="'+tooltip+'" class="category" id="'+category+'"/></a>';
  el.innerHTML = html;


  el = tr3.insertCell(1);
  category = "shopping";
  img_link = img_link = "http://boredombuster.googlecode.com/svn/trunk/images/128/"+category+".png";
  tooltip = prefs.getMsg(category);
  html = '<a href="javascript:searchBusters(\''+category+'\', \''+img_link+'\');" onmouseover="popupCategoryName(\''+escape(tooltip)+'\');"><img src="'+img_link+'" title="'+tooltip+'" class="category" id="'+category+'"/></a>';
  el.innerHTML = html;


  el = tr3.insertCell(2);
  category = "random";
  img_link = img_link = "http://boredombuster.googlecode.com/svn/trunk/images/128/"+category+".png";
  tooltip = "I'm just feeling bored!";
  html = '<a href="javascript:searchBusters(\''+category+'\', \''+img_link+'\');" onmouseover="popupCategoryName(\''+escape(tooltip)+'\');"><img src="'+img_link+'" title="I\'m just feeling bored!" class="category" id="'+category+'"/></a>';
  el.innerHTML = html;

  main.appendChild(table);
}
